package Day021_反射_注解.ZuoYe;

import java.lang.reflect.Method;

/**
 * @author zhangyan
 * @date 2020/5/15 16:28
 */
public class Test3 {
    public static void main(String[] args) throws Exception{

        // 获取Class对象
        Class clazz = Class.forName("Day021_反射_注解.ZuoYe.show");

        // 利用反射创建对象
        Show s = (Show) clazz.newInstance();

        // 利用反射获取show方法
        Method printMethod = clazz.getMethod("show");

        printMethod.invoke(s);

    }
}

class Show {
    public Show() {
    }
    public void show(){
        System.out.println("你好...");
    }
}